package com.songlanyun.modules.saleconfig.controller.api;

import cn.hutool.core.util.ObjectUtil;
import com.songlanyun.common.annotation.SysLog;
import com.songlanyun.common.utils.R;
import com.songlanyun.modules.saleconfig.entity.SaleConfig;
import com.songlanyun.modules.saleconfig.service.SaleConfigService;
import com.songlanyun.modules.user.controller.AbstractController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//import org.apache.shiro.authz.annotation.RequiresPermissions;


/**
 * 平台的销售配置
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-11-10 13:49:18
 */
@RestController
@RequestMapping("api/saleconfig")
public class SaleConfigApiController extends AbstractController {
    @Autowired
    private SaleConfigService saleConfigService;

    /**
     * 是否开启区域代理
     */
    @RequestMapping("/openPayment")
    public R openPayment() {
        SaleConfig saleConfig = saleConfigService.getConfig();
        boolean openPayment = false;
        if (ObjectUtil.isNotEmpty(saleConfig)) {
            openPayment = saleConfig.getOpenPayment();
        }
        return R.ok().put("openPayment", openPayment);
    }

}
